#ifndef __LDX_USTRINGUTILS_H_INCLUDE__
#define __LDX_USTRINGUTILS_H_INCLUDE__
#include <string>
#include <locale>

namespace ldx
{
	namespace os
	{
		class UStringUtils
		{
		public:
#pragma warning(push)
#pragma warning(disable:4996)//Because of the warning:unsigned int to int
			static std::wstring s2ws(const std::string& str)
			{
				unsigned int len = static_cast<mt::uint>(str.size() * 2);
				setlocale(LC_CTYPE, "");
				wchar_t* p = new wchar_t[len];
				mbstowcs(p, str.c_str(), len);
				std::wstring str1(p);
				delete[] p;
				return str1;
			}

			static std::string ws2s(const std::wstring& str)
			{
				unsigned int len = static_cast<mt::uint>(str.size() * 4);
				setlocale(LC_CTYPE, "");
				char* p = new char[len];
				wcstombs(p, str.c_str(), len);
				std::string str1(p);
				delete[] p;
				return str1;
			}

#pragma warning(pop)
		};
	}
}

#endif